<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019-2020 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace app\validate\system\affiche;

use think\Validate;

class AfficheValidate extends Validate
{
    protected $rule = [
        'id' => 'require|number',
        'title|文章标题' => 'require',
        'content_type|打开方式' => 'require|in:1,2',
        'content|文章内容' => 'requireIf:content_type,1',
        'network_url|外链地址' => 'requireIf:content_type,2',
    ];
    public function sceneAdd()
    {
        return $this->remove('id', 'require');
    }

    public function sceneEdit()
    {
        return $this->remove('id', 'require');
    }

    public function sceneDel()
    {
        return $this->only(['ids'])->append('ids', 'require|array');
    }

}